// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false
document.addEventListener("deviceready",function(){
   alert("=======")
   console.log(JPush.receiveRegistrationId)
   // console.log(jpush.receiveRegistrationId)
  new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>'
  })
  document.addEventListener('jpush.receiveRegistrationId',function(event){
     alert("啊哈哈哈哈哈",event)
  },false);
  initiateUI ();
  function initiateUI(){
     try {
      alert("11111111111111111")
        window.JPush.init ();
        window.JPush.setDebugMode(true); 
        getRegistrationID ();
        if(devicePixelRatio.platform !='Android'){
         alert("222222222222222222")
           window.JPush.setApplicationcationIconBadgeNumber(0);
        }
     } catch (exception) {
      alert("33333333333333333")
      alert(exception)
        alert('init' + exception)
     }
  }
 function getRegistrationID (){
   alert("444444444444444444")
     window.JPush.getRegistrationID(onGetReginstrationID);
 }
 function onGetReginstrationID(data){
    try {
       alert("5555555555555555555555")
       alert ('JPushPlugin: registrationID is' + data); 
    } catch(exception){
      alert("66666666666666666666666666")
       alert('onGetReg666' + exception) 
    }
 }
},false)



